
class Person{
    //普通成员变量
    public String name;
    public int age;

    //普通成员方法
    public void eat(){
        System.out.println("吃饭");
    }
    public void sleep(){
        System.out.println("睡觉");
    }
}

class MyGirlFired{
    //普通成员变量
    //又名字， 年龄， 眼睛
    public String name;
    public int age;
    public String eyes;

    public void eat(){
        System.out.println("吃火锅");
    }
}

class Student{
    public String name;
    public int age;
    public double score;
    public String sex;
    //重载
    public Student(){
        //转到带两个参数的构造方法
        this("gaobo",18);
        System.out.println("不带参数的构造方法");
    }

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }


    public Student(String name, int age, double score, String sex) {
        this.name = name;
        this.age = age;
        this.score = score;
        this.sex = sex;
        System.out.println("四个参数的构造方法");
    }

    public void doClass(){
        System.out.println(this.name + "正在上课了");
    }

    public void doHomeWork(){
        System.out.println(this.name + "正在做作业");
    }

    public void show(){
        System.out.println(name + " " + age + " " + score+" " + sex );
    }
}

public class TestDemo2 {

    public static void main(String[] args) {
        //类名 变量 = new 类名（）
        //实例化对象 创建一个对象
        Student student = new Student();
        student.age = 10;
        student.name = "bit";
        student.score = 10.9;
        student.sex = "男";
        student.doClass();
        student.doHomeWork();
        student.show();
        System.out.println("=========");

        Student student2 = new Student();
        student2.name = "gaobo";
        student2.age = 19;
        student2.score = 99.9;
        student2.sex = "男";
        student2.doClass();
        student2.doHomeWork();
        student2.show();
        System.out.println("============");

        Student student5 = new Student("gaobo", 18);
        student5.show();


    }

    public static void main2(String[] args) {
        Student student1 = new Student();
        Student student2 = new Student();
        Student student3 = new Student();
        Student student4 = new Student();
        Student student5 = new Student();

        MyGirlFired myGirlFired = new MyGirlFired();
    }

    public static void main1(String[] args) {
        int a = 10;
        Person person = new Person();
        person.eat();
    }
}
